﻿using System;
using System.Collections.Generic;
using System.Net.Mail;
using System.Text;
namespace Guline.Iuh.TichLuy.Utils
{
    public static class SMTPSendMail
    {
     
        public static bool SendMail(string to, string title, string content)
        {
            try
            {
                SmtpClient client = new SmtpClient();
                client.Port = 587;
                client.Host = "smtp.gmail.com";
                client.EnableSsl = true;
                client.Timeout = 10000;
                client.DeliveryMethod = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Credentials = new System.Net.NetworkCredential("contact@guline.com", "hienpham");
                content+="<br>recive result name:"+to;
                MailMessage mm = new MailMessage("contact@guline.com", "huyhieu@guline.com", title, content);
                mm.IsBodyHtml = true;
                mm.BodyEncoding = UTF8Encoding.UTF8;
                mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

                client.Send(mm);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}